using System;
using System.Collections.Generic;
using System.Text;

namespace ComputaGuru.SpEAd
{
    public class OperationDescriptor
    {
        public int OperationID;
        public string Name;
        public string OperationType;
        public EA.Method Operation;

        public OperationDescriptor(EA.Method sourceOperation )
        {
            this.OperationID = sourceOperation.MethodID;
            this.Name = sourceOperation.Name;
            this.OperationType = sourceOperation.ReturnType;
            this.Operation = sourceOperation;
        }

        public override string ToString()
        {
            string returnString = this.Operation.Visibility + " "
                                + this.Operation.ReturnType + " "
                                + this.Operation.Name + "(";

            for (short i = 0; i < Convert.ToInt16(this.Operation.Parameters.Count); i++)
            {
                returnString += (i == 0? String.Empty: ", ") + ((EA.Parameter)this.Operation.Parameters.GetAt(i)).Type;
            }

            return returnString + ")";
        }
    }
}
